package com.github.linmt.dbdoc4j.metadata.type.mysql;


import com.github.linmt.dbdoc4j.metadata.exception.TypeMappingException;
import com.github.linmt.dbdoc4j.metadata.type.IDataBaseTypeMapping;

import java.sql.JDBCType;

/**
 * User: Linmt
 * Date: 2022/12/10
 * Time: 18:21
 * Description: mysql类型映射
 */
public class MysqlTypeMapping implements IDataBaseTypeMapping {

    @Override
    public Class<?> toJavaType(String dbType) throws TypeMappingException {
        return MysqlTypeMappingEnum.getByName(dbType).javaClass;
    }

    @Override
    public JDBCType toJdbcType(String dbType) throws TypeMappingException {
        return MysqlTypeMappingEnum.getByName(dbType).getJdbcType();
    }
}
